package cc.beup.common.exception;

import cc.beup.common.constant.PlatformResponseCodeEnum;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * @Author: Byron Bai
 * @Date: 2021/4/18 16:13
 * @Description: 平台异常类
 */
@EqualsAndHashCode(callSuper = true)
@Data
public class PlatFormBizException extends RuntimeException {

    private String code;
    private String msg;
    private PlatformResponseCodeEnum responseCodeEnum;

    public PlatFormBizException(PlatformResponseCodeEnum responseCodeEnum) {
        super(responseCodeEnum.getMsg());
        this.code = responseCodeEnum.getCode();
        this.msg = responseCodeEnum.getMsg();
        this.responseCodeEnum = responseCodeEnum;
    }

    public PlatFormBizException(PlatformResponseCodeEnum responseCodeEnum, String extData) {
        super(responseCodeEnum.getMsg());
        this.code = responseCodeEnum.getCode();
        this.msg = responseCodeEnum.getMsg() + "|" + extData;
        this.responseCodeEnum = null;
    }

    public PlatFormBizException(String msg, String code) {
        super(msg);
        this.code = code;
        this.msg = msg;
    }


}
